#ifndef __TIMER_H__
#define __TIMER_H__

typedef int timer_t;

extern volatile const uint32_t timer_counter;
extern volatile const uint32_t timer_freq;

timer_t timer_open(int pid, uint32_t tp);
timer_t timer_open_ns(int pid, uint32_t ns);
timer_t timer_open_us(int pid, uint32_t us);
timer_t timer_open_ms(int pid, uint32_t ms);
void    timer_close(timer_t idx);

/* 0 for success, else for failed */
int     timer_test(timer_t idx);
int     timer_free(timer_t idx);
	 
#endif
